USE [Clinic] 
GO

ALTER TABLE ClinicDiagnosis
ADD Other nvarchar(500)

--******* ********--


/****** Object:  StoredProcedure [dbo].[up_ClinicDiagnosisUpdate]    Script Date: 01/15/2008 22:01:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[up_ClinicDiagnosisUpdate]
		  @ID int
		, @Rengen nvarchar(300)
		, @Rabotna nvarchar(300)
		, @Ehograh nvarchar(300)
		, @KAT nvarchar(500)
		, @Other nvarchar(500)
		, @patientID int
AS
BEGIN
	SET NOCOUNT ON;
	UPDATE [ClinicDiagnosis]
	SET 
		  [Rengen] = @Rengen
		, [Rabotna] = @Rabotna
		, [Ehograh] = @Ehograh
		, [KAT] = @KAT
		, [Other] = @Other
		, [patientID] = @patientID
	WHERE 
		[ID] = @ID
END

/******    ******/
/****** Object:  StoredProcedure [dbo].[up_ClinicDiagnosisInsert]    Script Date: 01/15/2008 22:01:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[up_ClinicDiagnosisInsert]
		  @ID int
		, @Rengen nvarchar(300)
		, @Rabotna nvarchar(300)
		, @Ehograh nvarchar(300)
		, @KAT nvarchar(500)
		, @Other nvarchar(500)
		, @patientID int
AS
BEGIN
	SET NOCOUNT ON;
	INSERT INTO [ClinicDiagnosis]
	(
		  [Rengen]
		, [Rabotna]
		, [Ehograh]
		, [KAT]
		, [Other]
		, [patientID]
	) 
	VALUES 
	(
		  @Rengen 
		, @Rabotna 
		, @Ehograh 
		, @KAT 
		, @Other
		, @patientID
	)		
END


/****** Object:  StoredProcedure [dbo].[up_ClinicDiagnosisGetAllByPatientID]    Script Date: 01/15/2008 22:01:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[up_ClinicDiagnosisGetAllByPatientID]
	  @PatientID int
	
AS
BEGIN
	SET NOCOUNT ON;
	SELECT *
	FROM [ClinicDiagnosis]
	WHERE 
		[PatientID] = @PatientID
END

/****** Object:  StoredProcedure [dbo].[up_ClinicDiagnosisDelete]    Script Date: 01/15/2008 22:01:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[up_ClinicDiagnosisDelete]
	  @ID int
	
AS
BEGIN
	SET NOCOUNT ON;
	DELETE FROM [ClinicDiagnosis]
	WHERE [ID] = @ID
END

/******    ******/
SET ANSI_NULLS ON